Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Add support for helm template #368

Merged
merged 4 commits into from
Feb 17, 2021

Conversation

gravesm
Copy link
Member

@gravesm gravesm commented Feb 11, 2021

SUMMARY

This commit adds basic support for helm template. The functionality
allows one to either render a chart's templates to a specific directory,
or capture the rendered templates as a string of concatenated yaml
documents.

Closes #367

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

helm_template

ADDITIONAL INFORMATION

Sorry, for the extensive diff on tests_chart.yml but I really wanted to fix our test teardown. Aside from indentation changes, the only lines in that file that are new are 3-11 and 325-349.


This commit adds basic support for helm template. The functionality
allows one to either render a chart's templates to a specific directory,
or capture the rendered templates as a string of concatenated yaml
documents.
@tima tima added the topic/helm Issues relating to helm plugins label Feb 11, 2021
@codecov
Copy link

codecov bot commented Feb 11, 2021

Codecov Report

Merging #368 (8d5d29b) into main (80b9140) will decrease coverage by 0.99%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #368      +/-   ##
==========================================
- Coverage   36.80%   35.81%   -1.00%     
==========================================
  Files           3        3              
  Lines         758      779      +21     
  Branches      148      154       +6     
==========================================
  Hits          279      279              
- Misses        430      451      +21     
  Partials       49       49              
Impacted Files Coverage Δ
...ommunity/kubernetes/plugins/module_utils/common.py 34.19% <0.00%> (-1.28%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 80b9140...8d5d29b. Read the comment docs.

Copy link
Contributor

@jillr jillr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of small docs nits, the Python parts of the module lgtm

plugins/modules/helm_template.py Show resolved Hide resolved
plugins/modules/helm_template.py Outdated Show resolved Hide resolved
plugins/modules/helm_template.py Outdated Show resolved Hide resolved
@gravesm gravesm changed the title [wip] Add support for helm template Add support for helm template Feb 16, 2021
Copy link
Collaborator

@tima tima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@jillr jillr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add something to the module docs about idempotency, we talked in slack and it sounds like the CLI is not idempotent so we should just note that so that users expecting Ansible's usual behaviour aren't surprised.

Could we add check mode support to this module? I'm not really familiar enough with how folks use Helm and would expect that to work, but in theory we could still build the command with --dry-run (or even just store the rendered yaml to stdout?).

output_dir: "{{ temp_dir }}"
values_files:
- "{{ role_path }}/files/values.yaml"
register: result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have some assertions for this task. is not failed, result.rc value, and result.command should be straightforward, depending on the reproducability and complexity of result.stdout there should be something we can assert about the shape or contents that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, examining stdout here will be difficult. This test suite gets run multiple times with different charts so the output will be different for each one. The same thing goes for examining result.command to some extent. I've added a check for as much of the command as we can reliably predict.


module.exit_json(
failed=False,
changed=False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed this the first time around, shouldn't changed always be True?

Copy link
Contributor

@jillr jillr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Thanks @gravesm

@gravesm gravesm merged commit a4ac078 into ansible-collections:main Feb 17, 2021
@gravesm gravesm deleted the helm-template branch February 19, 2021 18:00
@github-actions
Copy link

github-actions bot commented Nov 4, 2021

This repository does not accept pull requests, see the README for details.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
repo-lockdown topic/helm Issues relating to helm plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants